package mtest2.day2;

public class Demo1 {
    public static void main(String[] args) {
        //冒泡排序
        int[] arr = {19, 23, 57, 1, 99, 89, 233};
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                // 左侧的数字比右侧的大，交换两数
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }

            }

        }

        // 打印
        for (int x : arr) {
            System.out.print(x + "\t");
        }
    }

}
